https://leetcode.com/problems/invert-binary-tree/
反轉二元樹並回傳結果。
先交換節點,利用遞迴將某一邊之節點交換完成後,再換邊交換直到結束。
struct TreeNode* invertTree(struct TreeNode* root) {
    if(root==NULL)
    {
        return NULL;
    }
    struct TreeNode *temp_root;
    temp_root = root->left;
    root->left = root->right;
    root->right = temp_root;
    invertTree(root->left);
    invertTree(root->right);
    return root;
}
var invertTree = function(root) {
    if(root == null)
        return null;
    var temp;
    temp = root.left;
    root.left = root.right;
    root.right = temp;
    invertTree(root.left);
    invertTree(root.right);
    return root;
};
https://github.com/SIAOYUCHEN/leetcode
https://ithelp.ithome.com.tw/users/20100009/ironman/2500
https://ithelp.ithome.com.tw/users/20113393/ironman/2169
https://ithelp.ithome.com.tw/users/20107480/ironman/2435
https://ithelp.ithome.com.tw/users/20107195/ironman/2382
https://ithelp.ithome.com.tw/users/20119871/ironman/2210
https://ithelp.ithome.com.tw/users/20106426/ironman/2136
Don't forget the past when you are successful, don't forget the future when you fail.
成功的時候不要忘記過去,失敗的時候不要忘記還有未來